import { mapState, mapGetters } from 'vuex'
export default{
    data(){
        return {
			isMobile:false,
        }
    },
	computed:{
		...mapGetters(['loginInfo','getHeaderTabIndex','getMsgRead','getUserUnReadMsg','getCreateTeam','getIsTeamLeader']),
		isMobileWindow(){
			return this.isMobile
		},
	},
	watch:{
		loginInfo(){
			
		},
		getIsTeamLeader(){
			
		},
		getHeaderTabIndex(){
			
		},
		isMobileWindow(){
		},
	},
	methods:{
		setUnredMsg(){
			this.$store.dispatch('setUerUnReadMsg',{system_user_id:this.loginInfo.user_id})
		},
		getMsg(){
			this.$api.msgUnreadMsg({system_user_id:this.loginInfo.user_id}).then(res => {
				if(res.code == 200){
					// this.msg_read = res.data.msg_read
					this.$store.commit('setMsgRead',res.data.msg_read)
				}
			})
		},
		isCreateTeam(){
			this.$api.isCreateTeam({userId:this.loginInfo.user_id}).then(res => {
				if(res.code == 200){
					// this.msg_read = res.data.msg_read
					this.$store.commit('setCanCreateTeam',res.data.flag)
				}
			})
		},
		isTeamLeader(){
			this.$store.dispatch('set_isTeamLeader').then(res => {
				
			})
		},
		goArticle(data){
			if(data.url){
				window.open(data.url)
			}else{
				window.open('/work/pages/article/article?id='+ data.id +'&title='+data.title+'&cmd='+(data.cmd||''))
			}
			
			// this.utils.goPath('/pages/article/article')
			// /work/pages/article/article
		},
		getUnReadMsgIncomeExchange(){
			this.$api.unReadMsgIncomeExchange({
				system_user_id:this.loginInfo.user_id
			}).then(res => {
				if(res.code == 200){
					
				}
			})
		},
	},
	mounted(){
		let sys = uni.getSystemInfoSync()
		if(sys.windowWidth < 1024){
			this.isMobile = true;
		}
	}
   
}